// 导入基础布局组件
import Layout from '@/views/layout'
// 四个二级路由=》标签页
const Home = () => import('@/views/home')
const Question = () => import('@/views/question')
const Video = () => import('@/views/video')
const User = () => import('@/views/profile')
// 其它页面
const UserEdit = () => import('@/views/user/edit')
const Chat = () => import('@/views/user/chat')
const Login = () => import('@/views/login')
const Search = () => import('@/views/search')
const SearchResult = () => import('@/views/search/result')
const Detail = () => import('@/views/article')

const routes = [
  // 标签页配置
  {
    path: '/',
    component: Layout,
    children: [
      // 默认首页
      {
        path: '/',
        name: 'Home',
        component: Home,
        // 配置路由自定义参数
        meta: {
          isKeppAlive: true
        }
      },
      {
        path: '/question',
        name: 'Question',
        component: Question
      },
      {
        path: '/video',
        name: 'Video',
        component: Video
      },
      {
        path: '/user',
        name: 'User',
        component: User
      }
    ]
  },
  {
    path: '/user/profile',
    name: 'UserEdit',
    component: UserEdit
  },
  {
    path: '/user/chat',
    name: 'Chat',
    component: Chat
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },

  {
    path: '/search',
    name: 'Search',
    component: Search
  },
  {
    path: '/search/result',
    name: 'SearchResult',
    component: SearchResult
  },
  // 文章详情
  {
    path: '/article/:id',
    name: 'Detail',
    component: Detail,
    meta: {
      isKeppAlive: true
    }
  }
]

export default routes
